#include <iostream>  
#include <vector>  
#include <string>  
  
using namespace std;  
  
void restoreIPAddresses(string s, int start, int step, string address, vector<string>& result) {
    if (start == s.size() && step == 4) 
        result.push_back(address);  
        return;
    if (step >= 4 || start >= s.size())
        return;
    for (int len = 1; len <= 3; len++) {  
        if (start + len > s.size())
            break;
        string segment = s.substr(start, len);  
        int value = stoi(segment);
        if (value > 255 || (segment[0] == '0' && segment.size() > 1)) 
            continue;
        string nextAddress = address.empty() ? segment : address + "." + segment;
        restoreIPAddresses(s, start + len, step + 1, nextAddress, result);  
    }
}
  
vector<string> restoreIpAddresses(string s) {  
    vector<string> result;  
    restoreIPAddresses(s, 0, 0, "", result);  
    return result;  
}
  
int main() {  
    string s = "25525511135";  
    vector<string> result = restoreIpAddresses(s);  
    for (int i = 0; i < result.size(); i++) {  
        cout << result[i] << endl;  
    }
    return 0;  
}